package dk.iha;

import java.io.File;
import org.apache.log4j.Level;

import de.mindpipe.android.logging.log4j.LogConfigurator;
/**
 * Call {@link #configure()}} from your application's activity.
 */
public class ConfigureLog4J {
    public static void configure() {
        final LogConfigurator logConfigurator = new LogConfigurator();
                
        logConfigurator.setFileName(SharedData.getFilePath() + File.separator + "AdherenceLogger_log.txt");
        logConfigurator.setRootLevel(Level.WARN);
        // Set log level of a specific logger
        logConfigurator.setMaxFileSize(100000);//Max file size is 100KBytes - oldest data is then deleted
        logConfigurator.setMaxBackupSize(0);//do not take backups of the file
        logConfigurator.setLevel("org.apache", Level.ERROR);
        logConfigurator.configure();
    }
}


//Usage:
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//declare function:
//	private final Logger log = LoggerFactory.getLogger(The_actual_class_name.class);
//
//and write to file using: 
//	log.info("This message should be seen in log file and logcat");

